package com.wc.creative.自动刷题机;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/3/26 16:30
 * @description https://acm.creative3605.com/problems/436
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010;
    static int[] a = new int[N];
    static int n, k;

    public static void main(String[] args) {
        n = sc.nextInt();
        k = sc.nextInt();
        int cnt = 0;
        for (int i = 1; i <= n; i++) {
            a[i] = sc.nextInt();
            if (a[i] > 0) {
                cnt++;
            }
        }
        // 这个是必须加的
        if (cnt < k) {
            System.out.println(-1);
            return;
        }

        long l = 1, r = (long) 1e14;
        while (l < r) {
            long mid = l + r >> 1;
            if (check1(mid)) r = mid;
            else l = mid + 1;
        }
        long ansMin = l;
        l = 1;
        r = (long) 1e14;
        while (l < r) {
            long mid = l + r + 1 >> 1;
            if (check2(mid)) l = mid;
            else r = mid - 1;
        }
        long ansMax = r;
        if (ansMin > ansMax) {
            out.println(-1);
        } else {
            out.println(ansMin + " " + ansMax);
        }
        out.flush();
    }

    static boolean check1(long mid) {
        long cnt = 0;
        long sum = 0;
        for (int i = 1; i <= n; i++) {
            sum = Math.max(0, sum + a[i]);
            if (sum >= mid) {
                cnt++;
                sum = 0;
            }
        }

        return cnt <= k;
    }

    static boolean check2(long mid) {
        long cnt = 0;
        long sum = 0;
        for (int i = 1; i <= n; i++) {
            sum = Math.max(0, sum + a[i]);
            if (sum >= mid) {
                cnt++;
                sum = 0;
            }
        }
        return cnt >= k;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
